| subjects[4] = "Computer Science" |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | subjects[4] = "Computer Science" |
| subjects.pop(2) |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| subjects.pop(2) |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | subjects.pop(2) |
| 3 | subjects.pop(2) |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| a = subjects.pop(4) |
| print(a) |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | a = subjects.pop(4) |
| 3 | print(a) |
| arr = ["red","blue","green","purple","orange"] |
| 1 | arr = ["red","blue","green","purple","orange"] |
| print(arr) |
| arr = ["red","blue","green","purple","orange"] |
| arr[0] = i |
| i = input() |
| print("Enter a colour") |
| 1 | arr = ["red","blue","green","purple","orange"] |
| 2 | print("Enter a colour") |
| 3 | i = input() |
| 4 | arr[0] = i |
| 5 | print(arr) |
| j = input() |
| i = int(i) |
| print("Enter a subject to replace it with") |
| print(subjects) |
| subjects[i] = j |
| print("Enter an index") |
| print(subjects[i]) |
| i = input() |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | print("Enter an index") |
| 3 | i = input() |
| 4 | i = int(i) |
| 5 | print(subjects[i]) |
| 6 | print("Enter a subject to replace it with") |
| 7 | j = input() |
| 8 | subjects[i] = j |
| 9 | print(subjects) |
| print("Enter an index") |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| print("Invalid integer") |
| print("Enter a subject to replace it with") |
| i = int(i) |
| print(subjects[i]) |
| break |
| else: |
| j = input() |
| print(subjects) |
| if i.isdigit() and int(i) >= 0 and int(i) < len(subjects): |
| subjects[i] = j |
| while True: |
| i = input() |
| print("Enter an index") |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
|         print("Invalid integer") |
| print("Enter a subject to replace it with") |
|         i = int(i) |
| print(subjects[i]) |
|         break |
|     else: |
| j = input() |
| print(subjects) |
|     if i.isdigit() and int(i) >= 0 and int(i) < len(subjects): |
| subjects[i] = j |
| while True: |
|     i = input() |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | print("Enter an index") |
| 3 | while True: |
| 4 |     i = input() |
| 5 |     if i.isdigit() and int(i) >= 0 and int(i) < len(subjects): |
| 6 |         i = int(i) |
| 7 |         break |
| 8 |     else: |
| 9 |         print("Invalid integer") |
| 10 | print(subjects[i]) |
| 11 | print("Enter a subject to replace it with") |
| 12 | j = input() |
| 13 | subjects[i] = j |
| 14 | print(subjects) |
| print("Enter the subject you wish to replace it with") |
| break |
| l = len(subjects) |
| j = input() |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| print(subjects) |
| if subjects[x] == i: |
| print("Enter a subject you wish to replace") |
| i = input() |
| subjects[x] = j |
| for x in range(l): |
| print("Enter the subject you wish to replace it with") |
|         break |
| l = len(subjects) |
| j = input() |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| print(subjects) |
|     if subjects[x] == i: |
| print("Enter a subject you wish to replace") |
| i = input() |
|         subjects[x] = j |
| for x in range(l): |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | print("Enter a subject you wish to replace") |
| 3 | i = input() |
| 4 | print("Enter the subject you wish to replace it with") |
| 5 | j = input() |
| 6 | l = len(subjects) |
| 7 | for x in range(l): |
| 8 |     if subjects[x] == i: |
| 9 |         subjects[x] = j |
| 10 |         break |
| 11 | print(subjects) |
| queue = [] |
| else: |
| if i == "Add": |
| print("Adding " + i) |
| queue.append(i) |
| a = queue.pop(0) |
| print("Enter someone to add") |
| print("Serving " + a) |
| i = input() |
| while True: |
| print(queue) |
| i = input() |
| print("Add or Serve?") |
| print("Queue") |
| queue = [] |
|     else: |
|     if i == "Add": |
|         print("Adding " + i) |
|         queue.append(i) |
|         a = queue.pop(0) |
|         print("Enter someone to add") |
|         print("Serving " + a) |
|         i = input() |
| while True: |
|     print(queue) |
|     i = input() |
|     print("Add or Serve?") |
|     print("Queue") |
| 1 | queue = [] |
| 2 | while True: |
| 3 |     print("Queue") |
| 4 |     print(queue) |
| 5 |     print("Add or Serve?") |
| 6 |     i = input() |
| 7 |     if i == "Add": |
| 8 |         print("Enter someone to add") |
| 9 |         i = input() |
| 10 |         queue.append(i) |
| 11 |         print("Adding " + i) |
| 12 |     else: |
| 13 |         a = queue.pop(0) |
| 14 |         print("Serving " + a) |
| 15 |          |
| even = [] |
| for x in range(len(arr)): |
| if a % 2 == 0: |
| else: |
| print("Odd") |
| a = arr[x] |
| arr = [6,5,4,5,6,2,4] |
| print(odd) |
| even.append(a) |
| print(even) |
| odd.append(a) |
| print("Even") |
| odd = [] |
| even = [] |
| for x in range(len(arr)): |
|     if a % 2 == 0: |
|     else: |
| print("Odd") |
|     a = arr[x] |
| arr = [6,5,4,5,6,2,4] |
| print(odd) |
|         even.append(a) |
| print(even) |
|         odd.append(a) |
| print("Even") |
| odd = [] |
| 1 | arr = [6,5,4,5,6,2,4] |
| 2 | even = [] |
| 3 | odd = [] |
| 4 | for x in range(len(arr)): |
| 5 |     a = arr[x] |
| 6 |     if a % 2 == 0: |
| 7 |         even.append(a) |
| 8 |     else: |
| 9 |         odd.append(a) |
| 10 | print("Even") |
| 11 | print(even) |
| 12 | print("Odd") |
| 13 | print(odd) |
| arr[x] = arr[x] * 2 |
| arr = [6,5,4,5,6,2,4] |
| print(arr) |
| for x in range(len(arr)): |
|     arr[x] = arr[x] * 2 |
| arr = [6,5,4,5,6,2,4] |
| print(arr) |
| for x in range(len(arr)): |
| 1 | arr = [6,5,4,5,6,2,4] |
| 2 | for x in range(len(arr)): |
| 3 |     arr[x] = arr[x] * 2 |
| 4 | print(arr) |
| subjects[i] = subjects[j] |
| i = input() |
| i = int(i) |
| j = input() |
| print("Enter index 1") |
| print("Enter index 2") |
| j = int(j) |
| print(subjects) |
| temp = subjects[i] |
| subjects[j] = temp |
| subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 1 | subjects = ["Science", "Maths", "English", "History", "Geography"] |
| 2 | print("Enter index 1") |
| 3 | i = input() |
| 4 | i = int(i) |
| 5 | print("Enter index 2") |
| 6 | j = input() |
| 7 | j = int(j) |
| 8 | temp = subjects[i] |
| 9 | subjects[i] = subjects[j] |
| 10 | subjects[j] = temp |
| 11 | print(subjects) |
| indexes = [] |
| arr = [5,2,2,1,4,5,2,4,5,2] |
| if arr[x] == arr: |
| print(indexes) |
| index.append(x) |
| for x in range(len(arr)): |
| indexes = [] |
| arr = [5,2,2,1,4,5,2,4,5,2] |
|     if arr[x] == arr: |
| print(indexes) |
|         index.append(x) |
| for x in range(len(arr)): |
| 1 | arr = [5,2,2,1,4,5,2,4,5,2] |
| 2 | indexes = [] |
| 3 | for x in range(len(arr)): |
| 4 |     if arr[x] == arr: |
| 5 |         index.append(x) |
| 6 | print(indexes) |
| for x in range(len(arr)): |
| for y in range(len(s)): |
| print(arr) |
| t = t + int(s[y]) |
| s = str(arr[x]) |
| arr[x] = t |
| arr = [242,142,525] |
| t = 0 |
| for x in range(len(arr)): |
|     for y in range(len(s)): |
| print(arr) |
|         t = t + int(s[y]) |
|     s = str(arr[x]) |
|     arr[x] = t |
| arr = [242,142,525] |
|     t = 0 |
| 1 | arr = [242,142,525] |
| 2 | for x in range(len(arr)): |
| 3 |     t = 0 |
| 4 |     s = str(arr[x]) |
| 5 |     for y in range(len(s)): |
| 6 |         t = t + int(s[y]) |
| 7 |     arr[x] = t |
| 8 | print(arr) |
| t = t + int(s[y]) |
| print(arr) |
| t = 0 |
| arr[x] = t |
| arr = [242,142,525] |
| for y in range(len(s)): |
| s = str(arr[x]) |
| for x in range(len(arr)): |
|         t = t + int(s[y]) |
| print(arr) |
|     t = 0 |
|     arr[x] = t |
| arr = [242,142,525] |
|     for y in range(len(s)): |
|     s = str(arr[x]) |
| for x in range(len(arr)): |
| 1 | arr = [242,142,525] |
| 2 | for x in range(len(arr)): |
| 3 |     t = 0 |
| 4 |     s = str(arr[x]) |
| 5 |     for y in range(len(s)): |
| 6 |         t = t + int(s[y]) |
| 7 |     arr[x] = t |
| 8 | print(arr) |
| 9 |      |
| arr[x] = t |
| arr = [242,142,525] |
| s = str(arr[x]) |
| for x in range(len(arr)): |
| t = t + int(s[y]) |
| for y in range(len(s)): |
| print(arr) |
| t = 0 |
|     arr[x] = t |
| arr = [242,142,525] |
|     s = str(arr[x]) |
| for x in range(len(arr)): |
|         t = t + int(s[y]) |
|     for y in range(len(s)): |
| print(arr) |
|     t = 0 |
| 1 | arr = [242,142,525] |
| 2 | for x in range(len(arr)): |
| 3 |     t = 0 |
| 4 |     s = str(arr[x]) |
| 5 |     for y in range(len(s)): |
| 6 |         t = t + int(s[y]) |
| 7 |     arr[x] = t |
| 8 | print(arr) |
| currentHeight = h - x |
| row = "" |
| if height[y] >= currentHeight: |
| else: |
| for y in range(len(height)): |
| row = row + "#" |
| for x in range(5): |
| row = row + " " |
| height = [0,1,0,2,1,0,1,3,2,1,2,1] |
| print(row) |
|     currentHeight = h - x |
|     row = "" |
|         if height[y] >= currentHeight: |
|         else: |
|     for y in range(len(height)): |
|             row = row + "#" |
| for x in range(5): |
|             row = row + " " |
| height = [0,1,0,2,1,0,1,3,2,1,2,1] |
|     print(row) |
| 1 | height = [0,1,0,2,1,0,1,3,2,1,2,1] |
| 2 | |
| 3 | for x in range(5): |
| 4 |     currentHeight = h - x |
| 5 |     row = "" |
| 6 |     for y in range(len(height)): |
| 7 |         if height[y] >= currentHeight: |
| 8 |             row = row + "#" |
| 9 |         else: |
| 10 |             row = row + " " |
| 11 |     print(row) |
| print(water) |
| currentHeight = h - x |
| for x in range(len(water)): #Start from the left and move right |
| for y in range(len(height)): |
| if height[y] >= currentHeight: #If the terrain is equal to or higher than the water then print terrain |
| water = [h,h,h,h,h,h,h,h,h,h,h,h] |
| x = len(height) - x - 1 |
| row = row + colored.fg("blue") + "#" + colored.fg("white") |
| height = [0,1,0,2,1,0,1,3,2,1,2,1] |
| if y <= height[x]: #For each height keep decreasing the water height until you reach terrain |
| import colored |
| for x in range(len(water)): #Start from the right and move left |
| elif water[y] >= currentHeight:#If the terrain is lower than the water level, draw the water |
| break |
| for y in range(h): |
| print(row) |
| if y <= height[x]: #For each height keep decreasing the water height until you reach terrain |
| row = row + " " |
| row = "" |
| water[x] = y - 1 |
| else: #No water and no terrain |
| for x in range(h): #This for loop prints out the map |
| break |
| y = h - y #reverse the order, starting at 5 going to 0 |
| h = 5 |
| water[x] = y - 1 |
| row = row + "#" |
| print(water) |
|     currentHeight = h - x |
|     for x in range(len(water)): #Start from the left and move right |
|     for y in range(len(height)): |
|         if height[y] >= currentHeight: #If the terrain is equal to or higher than the water then print terrain |
| water = [h,h,h,h,h,h,h,h,h,h,h,h] |
|         x = len(height) - x - 1 |
|             row = row + colored.fg("blue") + "#" + colored.fg("white") |
| height = [0,1,0,2,1,0,1,3,2,1,2,1] |
|         if y <= height[x]: #For each height keep decreasing the water height until you reach terrain |
| import colored |
|     for x in range(len(water)): #Start from the right and move left |
|         elif water[y] >= currentHeight:#If the terrain is lower than the water level, draw the water |
|             break |
| for y in range(h): |
|     print(row) |
|         if y <= height[x]: #For each height keep decreasing the water height until you reach terrain |
|             row = row + " " |
|     row = "" |
|         water[x] = y - 1 |
|         else: #No water and no terrain |
| for x in range(h): #This for loop prints out the map |
|             break |
|     y = h - y #reverse the order, starting at 5 going to 0 |
| h = 5 |
|         water[x] = y - 1 |
|             row = row + "#" |
| 1 | import colored |
| 2 | height = [0,1,0,2,1,0,1,3,2,1,2,1] |
| 3 | |
| 4 | h = 5 |
| 5 | water = [h,h,h,h,h,h,h,h,h,h,h,h] |
| 6 | for y in range(h): |
| 7 |     y = h - y #reverse the order, starting at 5 going to 0 |
| 8 |      |
| 9 |     for x in range(len(water)): #Start from the left and move right |
| 10 |         water[x] = y - 1 |
| 11 |         if y <= height[x]: #For each height keep decreasing the water height until you reach terrain |
| 12 |             break |
| 13 |      |
| 14 |     for x in range(len(water)): #Start from the right and move left |
| 15 |         x = len(height) - x - 1 |
| 16 |         water[x] = y - 1 |
| 17 |         if y <= height[x]: #For each height keep decreasing the water height until you reach terrain |
| 18 |             break |
| 19 |      |
| 20 | print(water) |
| 21 |              |
| 22 | for x in range(h): #This for loop prints out the map |
| 23 |     currentHeight = h - x |
| 24 |     row = "" |
| 25 |     for y in range(len(height)): |
| 26 |         if height[y] >= currentHeight: #If the terrain is equal to or higher than the water then print terrain |
| 27 |             row = row + "#" |
| 28 |         elif water[y] >= currentHeight:#If the terrain is lower than the water level, draw the water |
| 29 |             row = row + colored.fg("blue") + "#" + colored.fg("white") |
| 30 |         else: #No water and no terrain |
| 31 |             row = row + " " |
| 32 |     print(row) |
| 33 |              |
| 34 |      |